<template>
	<view class="wrap bggrey">
		<topInfo :userInfo="userInfo"></topInfo>

		<!-- index-banner -->
		<view class="index-banner">
			<u-swiper style="margin: 0 auto;"  :list="Carousel" keyName="imageUrl"  height="150">

			</u-swiper>
		</view>
		<!-- notice -->
		<view class="index-notice-row fc-bet">
			<view class="title fc">
				<image style="width: 14px" src="../../../static/img/icon-notice.png" alt=""></image>
				<text>系统公告</text>
			</view>
			<u-notice-bar icon='' :text="notices" bgColor="rgb(255 255 255 / 0%);" color="#000000"
				mode="closable"></u-notice-bar>
			<view class="more">
				<navigator url="/pages/tabBar/index/platform?typeid=1">
					<span>更多</span>
				</navigator>
			</view>
		</view>
		<view class="m022">
			<view id="otherVideo1"></view>
		</view>
		<view class="index-menu flex m022" style="margin-top: 0.5rem; flex-wrap: wrap;">
			<navigator url="/pages/tabBar/index/platform?typeid=1" class="fc-h-index">
				<view class="img fcc" style="background-color: #08a97c">
					<image src="../../../static/img/index/3c4b5d53be0f31411092cec05cc96cc6.png" alt=""></image>
				</view>
				<text>平台公告</text>
			</navigator>
			<navigator class="fc-h-index">
				<view class="img fcc" style="background-color: #08a97c">
					<image src="../../../static/img/index/7afa06424816a64e41da79fb2d3ccb28.png" alt=""></image>
				</view>
				<text>企业资质</text>
			</navigator>
			<navigator url="/index_lmnr/22" class="fc-h-index">
				<view class="img fcc" style="background-color: #08a97c">
					<image src="../../../static/img/index/6e56dc0be47bb43b81297ad39bb93647.png" alt=""></image>
				</view>
				<text>担保协议</text>
			</navigator>
			<navigator url="/pages/tabBar/index/movice" class="fc-h-index">
				<view class="img fcc" style="background-color: #08a97c">
					<image src="../../../static/img/index/64ebe9fb2a29016931824594298.png" alt=""></image>
				</view>
				<text>猫眼票房</text>
			</navigator>
			<navigator url="/index_lmnr/26" class="fc-h-index">
				<view class="img fcc" style="background-color: rgba(8, 169, 126, 1)">
					<image src="../../../static/img/index/c49a6b07971fdd3a3de94eda1f23a34f.png" alt=""></image>
				</view>
				<text>安全保障</text>
			</navigator>
			<navigator url="/index_lmnr/19" class="fc-h-index">
				<view class="img fcc" style="background-color: #08a97c">
					<image src="../../../static/img/index/9d982d5b8f5b14ee6106b9be477829ae.png" alt=""></image>
				</view>
				<text>企业介绍</text>
			</navigator>
			<navigator url="/index_lmnr/24" class="fc-h-index">
				<view class="img fcc" style="background-color: #08a97c">
					<image src="../../../static/img/index/777cd8419ebeffa709974314381464e3.png" alt=""></image>
				</view>
				<text>企业宗旨</text>
			</navigator>
			<navigator url="/index_lmnr/31" class="fc-h-index">
				<view class="img fcc" style="background-color: #08a97c">
					<image src="../../../static/img/index/650058dfbfef316945215675332.png" alt=""></image>
				</view>
				<text>管道发展</text>
			</navigator>
		</view>

		<PanelList :obejdata='obejdata' @childEvent="handleChildEvent"></PanelList>
		<view class="box-title m022 fc" style="padding-top: 0.8rem;">
			<view class="fc">
				<i></i>
				<h3>热门资讯</h3>
				<navigator url="/pages/tabBar/index/platform?typeid=2">
					<view class="right">更多</view>
				</navigator>
			</view>
		</view>
		<view class="xw_box m022">
			<view class="xw_box_li" v-for="(news, index) in newsList" :key="index" @click="navigateToNews(news.link)">
				<view class="img">
					<image :src="news.imageUrl" mode="aspectFill"></image>
				</view>
				<view class="box">
					<h1>{{ news.ntitle }}</h1>
					<p class="text">{{ news.ncontent }}</p>
				</view>

			</view>
		</view>
		<view class="page-safe fc-bet m022" style="margin-top: 1rem;">
			<view class="col fc">
				<image src="../../../static/img/index/64caef0ce800916910210687561.png" alt=""></image>
				<view>
					<p>风险保障</p>
					<p>多重管控</p>
				</view>
			</view>
			<view class="col fc">
				<image src="../../../static/img/index/64caeefc74a0416910210527104.png" alt=""></image>
				<view>
					<p>签订银行</p>
					<p>存管协议</p>
				</view>
			</view>
			<view class="col fc">
				<image src="../../../static/img/index/64caeef7ee37c16910210474658.png" alt=""></image>
				<view>
					<p>ICP认证</p>
					<p>安全可靠</p>
				</view>
			</view>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex";
	import topInfo from '@/components/index/topInfo.vue'
	import PanelList from '@/components/index/panobj.vue'
	export default {
		components: {
			PanelList,
			topInfo
		},
		data() {
			return {
				obejdata: []
					// progressPercentage: 30,
					// totalAmount: '100.00万',
					// projectYield: '0.80%',

					,
				Carousel: [

				],
				show: false,
				newsList: [{
						title: "新闻标题",
						description: "新闻描述新闻描述新闻描述新闻描述",
						image: "../../../static/img/index/9e2a1355eabd804bb9e2d5e8a8c21f2a.png",
						link: "/index_xwnr/20",
					},
					// 可以添加更多新闻
				],
				notices: '',
				typeid: null,
				found: [],
				fou: []
			};
		},
		mounted() {
			this.getSwiper()
			this.getNotice()
			this.getPro()
			this.getNews()
			console.log(this.$store.state.userInfo)
		},
		computed: {
			...mapState(['userInfo']),
		},
		methods: {
			handleChildEvent(data) {
				this.$refs.uToast.show({
					type: 'loading',
					title: '正在加载',
					message: "正在加载",
					iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/loading.png'
				})
				const tabTypeMapping = {
					'全部': null,
					'战略投资区': 1,
					'C轮投资区': 2,
					// Add more tabs and typeid values as needed
				};
				this.typeid = tabTypeMapping[data];

				this.getPro()
			},
			navigateTo(url) {
				uni.navigateTo({
					url: url,
				});
			},
			getPro() {
				const param = {
					current: 1,
					size: 9,
					partitionId: this.typeid
				}

				this.$request.get('/CatProjec/all', param).then(res => {
					if (res.code == 200) {

						const priject = res.data.project.records;

						this.obejdata = priject

					}

				})
			},
			getSwiper() {
				this.$request.get('/system/carousel/all', {}).then(res => {
					if (res.code == 200) {
						const image_urls = res.data.Banner.records;

						// let image_url_list = image_urls.split(',')

						this.Carousel = image_urls
					}

				})
			},
			getNotice() {
				this.$request.get('/CatNotise/look/1', {}).then(res => {

					if (res.code == 200) {
						const content = res.data.notise.noContent;
						this.notices = content
					}

				})
			},
			getNews() {
				const param = {
					current: 1,
					size: 1
				}
				this.$request.get('/CatNews/list', param).then(res => {
					if (res.code == 200) {
						const content = res.data.news.records;
						this.newsList = content
					}

				})
			},
			gotomore(val) {
				uni.navigateTo({
					url: `/pages/tabBar/index/platform?typeid=${val}`, // 指定目标页面的URL
				});
			},
			navigateToNews(url) {
				uni.navigateTo({
					url: url,
				});
			},
		},
	};
</script>

<style scoped>
	/deep/uni-view[data-v-3b2b1a80],
	uni-scroll-view[data-v-3b2b1a80],
	uni-swiper-item[data-v-3b2b1a80] {
		margin: 0 auto;
	}

	/deep/.u-tabs__wrapper__nav__item {
		padding: 0 1rem;
	}

	/* 在这里添加你的CSS样式 */
	.tab-bar-box-center {
		display: block;
		width: 100%;
	}

	.padding {
		padding: 0.56rem 0.44rem 0.1rem 0.44rem;
	}

	.tab-bar-box-center .tab {
		display: inline-flex;
		width: auto;
		width: 32%;
	}

	video {
		display: block;
		width: 100%;
		background: #000;
		margin-bottom: 0.44rem;
	}

	.fc-h-index {
		width: 24.9999%;
	}

	.basedLogistics-item .label_man {
		position: absolute;
		width: 100%;
		left: 0;
		top: 32%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.tab-bar-box {
		height: auto;
		border-radius: 0.32rem;
		margin-bottom: 0.48rem;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.tab-bar-box a span {
		font-size: 0.52rem;
		font-weight: 400;
		color: #333333;
		line-height: 0.4rem;

	}

	.basedLogistics-item .label span {
		height: auto !important;
	}

	.sygg-box {
		position: relative;
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		padding: 1rem;
	}

	.tus {
		margin-right: 0.35rem;
		width: 2.5rem;
		vertical-align: middle;
		height: 100%;
	}

	.chanping-txt .span {
		font-size: 0.7rem;
		font-weight: 550;
		color: #000000;
		height: 1rem;
		line-height: 1.06rem;
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}

	.chping-text {
		font-size: 0.7rem;
	}

	.chanping-btn {
		width: 100%;
		border-radius: 0 0 0.5rem;
		box-sizing: border-box;
		height: 1.5rem;
		background: #0b6fc0;
		color: rgba(255, 255, 255, 1);
		margin-top: 0.5rem;
		display: flex;
		justify-content: center;
		align-items: center;
		text-align: center;
	}

	.changping-kuang-txt {
		font-size: 0.55rem;
		color: #0a0909;
		height: 1rem;
		border-radius: 5px 5px 0 0;
		font-weight: 500;
		display: flex;
		background-color: #f7f4ed !important;
		align-items: center;
		justify-content: center;
	}
</style>